MQTT Interface
This document describes the MQTT topics that are used to communicate with viaSens devices.
Before using MQTT to communicate with a certain viaSens device, it needs to be provisioned and its gateway needs to be connected to MQTT broker. Specification relies on the MQTT version 3.1 or higher.
Smart Sensor MQTT Topics
| Topic | Description | Retain |
|---|---|---|
| Node with the address of Example below shows the packet describing humidity data posted to this topic. By receiving the configuration packet, the device is sure the status packet was published over MQTT - meaning everything is ready for sending startup values of all sensors. Those values will also be sent every time the new configuration packet is received. To this topic: Gateway publishes, MQTT broker subscribes. | no |
| Control the node from the Example below shows the packet describing the control of the LED Ring. To this topic: Gateway subscribes, MQTT broker publishes. | no |
| Configure the node from the Retaining a message ensures that the gateway can hard reset and still be able to collect the configuration of all nodes from the network. Example below shows the packet describing the configuration of a single node. To this topic: Gateway subscribes, MQTT broker publishes. | yes |
| Gateway sends the acknowledgment ("ack"/"fail") to this topic if the message published to the The acknowledgment payload state attribute can contain the following values:
Example below shows the packet describing the feedback payload: Failure to receive an acknowledgement payload or receiving a "fail" acknowledgement shall result in the controller reporting a communication error. | no |
| Node Example below shows the packet describing the metadata of a single node. The status packet may optionally include field calibration data if it is different from the default factory values. The MQTT API version is specified in the api attribute. This field is optional before FW 2.1 and is set to "2" from FW v2.1 onwards. To this topic: Gateway publishes, MQTT broker subscribes. | yes |
| Last Will and Testament is a feature of MQTT for notifying the clients when the gateway ungracefully disconnects from the broker. When the gateway connects to the broker, it will send 1 to the presence topic and when it disconnects, the broker will notify other clients by sending 0 to the same topic. These messages are RETAINED which allows other applications to check if the gateway is connected to the broker at any point in time. To this topic: Gateway publishes, MQTT broker subscribes. | yes |
Gateway subscribes to the following topics:
| Topic | Description |
|---|---|
| Listens for Smart Sensor Data control packets. Fetch the destination node address from topic ( |
| Listens for Smart Sensor Config Data configuration packets. Fetch the destination node address from topic ( |